Skip to content

CLN: simplify get_values usage in groupby #32523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2020

Conversation

jbrockmendel
Copy link
Member

This will avoid an object-casting for e.g. IntervalArray-backed ExtensionBlock.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check ASV for count?

@WillAyd
Copy link
Member

WillAyd commented Mar 7, 2020

Or if overkill just a quick timeit

@jbrockmendel
Copy link
Member Author

Or if overkill just a quick timeit

ts = pd.Timestamp("2016-01-01", tz="UTC")
ii = pd.interval_range(start=ts, end=ts + pd.Timedelta(days=10**4))       
df = pd.DataFrame({"A": ii.right, "B": ii.left, "C": ii, "D": ii.left.year})
gb = df.groupby("D")

In [5]: %timeit gb.count()                                                                                                                                                                            
378 µs ± 6.23 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)  # <-- PR
211 ms ± 18.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)  # <-- master

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jreback jreback added this to the 1.1 milestone Mar 11, 2020
@jreback jreback merged commit 2579484 into pandas-dev:master Mar 11, 2020
@jbrockmendel jbrockmendel deleted the get_values-gbg branch March 11, 2020 03:10
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants